UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tNbtBoep7JW/E5e33Gqc+yuH3xBbHeUBAHVm3Tp7gMc=' 
WHERE 
  key_id = '60ad5e4884396e4096c210639e82c1465604562b4a584c0d66cb9ea447097335' 
  AND (
    token = 'tNbtBoep7JW/E5e33Gqc+yuH3xBbHeUBAHVm3Tp7gMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041