UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HOG8+Vn5sgPek6QpcYIGb7cEm9kx4K7d0S5hs1Mh8pI=' 
WHERE 
  key_id = 'e04942b7b758f7ab4471887d320155ceac90b0e8158011cad96389731d03a2a8' 
  AND (
    token = 'HOG8+Vn5sgPek6QpcYIGb7cEm9kx4K7d0S5hs1Mh8pI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040