UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iYi4N9cf9Oh673aWC/0tfi8NKYOPs27bCaipOA45UG4=' 
WHERE 
  key_id = '6000feececa9ca4f4b2f4187e7a6f2389999705d3dffa5be8e853232aa409078' 
  AND (
    token = 'iYi4N9cf9Oh673aWC/0tfi8NKYOPs27bCaipOA45UG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048