UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qrt1rdN+GJdRpv+LRvhK1XwiSVpT2ZYoI2O6uGv3fmw=' 
WHERE 
  key_id = '8e02bdde4b0c5ecec3376de704e9df5bf00b92f07b67424b2b71b01aa5340ec1' 
  AND (
    token = 'Qrt1rdN+GJdRpv+LRvhK1XwiSVpT2ZYoI2O6uGv3fmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023