UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Gf/Idz283j8P3c7diFwZOONI8Al1IEZUpQM1dW5TO4=' 
WHERE 
  key_id = '18a6759c8d6952e6228181ac8c8d5e95a31232402f5643c1d9052124ac11ea02' 
  AND (
    token = '1Gf/Idz283j8P3c7diFwZOONI8Al1IEZUpQM1dW5TO4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047