UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fyCHo4+HCTvlH2TRbY664x6cNJ6GmowZsJMogcvrJ7Q=' 
WHERE 
  key_id = '08dd407baa2bb1a2281f2deb11fc16122b5be35b8b0f7c8e09bdbb96b5de4759' 
  AND (
    token = 'fyCHo4+HCTvlH2TRbY664x6cNJ6GmowZsJMogcvrJ7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072