UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7MaOOGBS6B47BxupjaxnX0kT72NjwnszHEU6yJL7tXU=' 
WHERE 
  key_id = 'e80606126c3c5a6a3aeba64c74d753eb3ffbc79b8ac9331275a1d3d1df743e7c' 
  AND (
    token = '7MaOOGBS6B47BxupjaxnX0kT72NjwnszHEU6yJL7tXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053