UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HETGI7o219rLV4P9RpujcNPJd+juTqQZcEg/7veox4E=' 
WHERE 
  key_id = '17e79209ffe79fd7db02060a7a82a1ae819b36f0f3cf23b4f26154fa621c8c5d' 
  AND (
    token = 'HETGI7o219rLV4P9RpujcNPJd+juTqQZcEg/7veox4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038