UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oL8ZJfLpD4fD9QIXbO+VrdxBAt5riBaIblWzcPqnPVw=' 
WHERE 
  key_id = 'fe46be0b56a962dea432e0f705f9b9c7a8227f93c51a7148f7348a367946d5de' 
  AND (
    token = 'oL8ZJfLpD4fD9QIXbO+VrdxBAt5riBaIblWzcPqnPVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036