UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k2WVMLz5PZP1jfPTEkS/laTMhwDyCO0GkhBik50U58E=' 
WHERE 
  key_id = 'c0790ac631628cd96c08bd3cd753641b6dd2f435fab57967930ca2678699123c' 
  AND (
    token = 'k2WVMLz5PZP1jfPTEkS/laTMhwDyCO0GkhBik50U58E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042