UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Rz0ThDdsjIbXEyB8IJGaL5rFtd3LAhymavwVX9YQ4E=' 
WHERE 
  key_id = 'ebd20f41c5263cc1b6e33a6aca9ff91f8530439181e3cb6298402872a44b3664' 
  AND (
    token = '0Rz0ThDdsjIbXEyB8IJGaL5rFtd3LAhymavwVX9YQ4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00094