UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CevKHf2gzjw5wEzVThW4U/xx5rpyFiLamIYRwg17q4w=' 
WHERE 
  key_id = '998376aaaf677898ab0e3cea6b1c90284dd82e1f90717d8200026b21cd54fd23' 
  AND (
    token = 'CevKHf2gzjw5wEzVThW4U/xx5rpyFiLamIYRwg17q4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043