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

Query time 0.00044