UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D0a4r3SbjwCGejYDRr6PkUiz4ogv7NQAHO+ZpqSK3wQ=' 
WHERE 
  key_id = '36f50022eaa50499f087b57de56c15855d4c8e73ca62f3de5c88f28975ce2472' 
  AND (
    token = 'D0a4r3SbjwCGejYDRr6PkUiz4ogv7NQAHO+ZpqSK3wQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040