UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AxdaRSNhgmY+OON3jav/S43wWwLeGOhBR3lano4zbuw=' 
WHERE 
  key_id = '2671718bddaf9318dba1f8acd0f45a9e309a58d5d6a04aa41142ca6fffa08811' 
  AND (
    token = 'AxdaRSNhgmY+OON3jav/S43wWwLeGOhBR3lano4zbuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028