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

Query time 0.00029