UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CPV76grPd5Ww4rz6Vmr/wpNID0o46k4jcWNEFN8rZgo=' 
WHERE 
  key_id = '318b64519d1df0bf9ac3955dd0f62d6acc192f425028af02fbf084ef95c05f5a' 
  AND (
    token = 'CPV76grPd5Ww4rz6Vmr/wpNID0o46k4jcWNEFN8rZgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044