UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '64AM71Albe9HCkRoT08n9+QDpeWl+SyotnyjpMkCcxw=' 
WHERE 
  key_id = 'bce4afbf13f3ebe65e3a2e8a9445cb56a990f2f8b972e1545cfb2f489b30a339' 
  AND (
    token = '64AM71Albe9HCkRoT08n9+QDpeWl+SyotnyjpMkCcxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028