UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JDm7q74VHq0BJvzE+Lx/OjnAcTWQbW5DKPsp17uE2aA=' 
WHERE 
  key_id = '610b7a434af9bd5dcbdaa6affb90089063e8395ca9da2e9212636ed70a6c4480' 
  AND (
    token = 'JDm7q74VHq0BJvzE+Lx/OjnAcTWQbW5DKPsp17uE2aA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044