UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x/HKUL09Kkkl2DyMvzZbf5cn8AHTYdXg0/Z0gZT21jI=' 
WHERE 
  key_id = 'ca4b04988c5206a742abdd33e264ef478c06315981a375038db680fbc2bed278' 
  AND (
    token = 'x/HKUL09Kkkl2DyMvzZbf5cn8AHTYdXg0/Z0gZT21jI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034