UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dy9qI9F0Bevh3Kgh9EwqkhZVbjN2r+YkN7de5RDPw7g=' 
WHERE 
  key_id = 'd3ada21f51eebd4841dce11e4f16df31a68f1103f18ea41df0f83d1cae3d7ae1' 
  AND (
    token = 'Dy9qI9F0Bevh3Kgh9EwqkhZVbjN2r+YkN7de5RDPw7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030