UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'roq26u4Nifvkj7KIX0vYE2naj4S2NELA5Cx9OZahSvY=' 
WHERE 
  key_id = '16c943eab6844f4778e051960122af65e56854042f42372309fc93524d4b364a' 
  AND (
    token = 'roq26u4Nifvkj7KIX0vYE2naj4S2NELA5Cx9OZahSvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040