UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M9K8xTy+iBEjYcAif/2IMg/0+gtl0aUJWC1jEjjJAPg=' 
WHERE 
  key_id = '712c361b3a4ad2f548a157e55bf7cf831cd2b206cf1d76f0adc3692b06382a42' 
  AND (
    token = 'M9K8xTy+iBEjYcAif/2IMg/0+gtl0aUJWC1jEjjJAPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042