UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dOFoY+0z9BAJJvfy+9xOATZe8YUFXHOSrita5AqadIc=' 
WHERE 
  key_id = 'e34c626e615a6bd94b6977b34c75d86bcd9520b704203750afe0ad12e3def313' 
  AND (
    token = 'dOFoY+0z9BAJJvfy+9xOATZe8YUFXHOSrita5AqadIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035