UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7eCtxJ1EL6mBbF+NrxmtSDwxNPg/s30Bu2/ammar5uU=' 
WHERE 
  key_id = 'ea4ad1273af593fb816b116427264c75251aa175eab860045285026d6ff5e751' 
  AND (
    token = '7eCtxJ1EL6mBbF+NrxmtSDwxNPg/s30Bu2/ammar5uU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037