UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cbqKyVS4v+DwCV+1/YwU8V8C1+AMG3ude52QalCct3U=' 
WHERE 
  key_id = 'a17af29f2bf0d928f5843876b2393401bdb68dc05da96c44e6cfc879bd73a7b2' 
  AND (
    token = 'cbqKyVS4v+DwCV+1/YwU8V8C1+AMG3ude52QalCct3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034