UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dmjPVnSRbp/TmSSpNUfO/qg63ubSOIjfubw4fUSy/6k=' 
WHERE 
  key_id = '5072b1c0235aa927d0ef6ab7252dfff852de7e508f9cce7b9185337b06e94770' 
  AND (
    token = 'dmjPVnSRbp/TmSSpNUfO/qg63ubSOIjfubw4fUSy/6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036