UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kRLevXIZJtG20Ii8qzphWYvzfjSyfBFSAVCemNhHap8=' 
WHERE 
  key_id = 'f45982804fa7d2f7dba6327b6530743241db1e93463c667f78cec2d81e0cdac1' 
  AND (
    token = 'kRLevXIZJtG20Ii8qzphWYvzfjSyfBFSAVCemNhHap8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051