UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WG57j4DqU4eEDp6MfjS+HvTwXZ9T+fmiqfPghRcgnDs=' 
WHERE 
  key_id = '1ca3325be39a56b7e7404419155a1bfeba31eb84cedbd3bc63b6cb105b91163c' 
  AND (
    token = 'WG57j4DqU4eEDp6MfjS+HvTwXZ9T+fmiqfPghRcgnDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016