UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FnyHVPqvVHFteCv+bm+18ZDZjccVct+PxVFW1brJtgY=' 
WHERE 
  key_id = '7194c4baa08de48df9d60633728b06c8f22666a350da1184c1a1306aa6060572' 
  AND (
    token = 'FnyHVPqvVHFteCv+bm+18ZDZjccVct+PxVFW1brJtgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030