UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YO8ICntmwzjgwpNV7AYEl4X/gvt/U15ScgFFh4ZFAoM=' 
WHERE 
  key_id = '022113cf4d66c65692dcfb33aa1650c0a31cba6b88ec2b4c1b3ba93f53226417' 
  AND (
    token = 'YO8ICntmwzjgwpNV7AYEl4X/gvt/U15ScgFFh4ZFAoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038