UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x3CM/2wMzsG2phREKIvEN3Fmu2BAxpi3gb1MDtqDNFg=' 
WHERE 
  key_id = 'c765b0313694e1f21b4c5397405a720ac8520c6fcd8435e14b88474a33da98c5' 
  AND (
    token = 'x3CM/2wMzsG2phREKIvEN3Fmu2BAxpi3gb1MDtqDNFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039